<template>
  <div id="teaJobProvided">
    <h1>学生列表</h1>
    <a-table
      :ref="tableRef"
      :columns="columns"
      :data="dataList"
      style="margin-top: 20px"
    >
      <template #schedule="{ record }">
        <a-tag
          v-if="record.schedule === '1'"
          color="red"
          :default-checked="true"
          bordered
          >未就业
        </a-tag>
        <a-tag
          v-else-if="record.schedule === '2'"
          color="cyan"
          :default-checked="true"
          bordered
          >审核中
        </a-tag>
        <a-tag
          v-else-if="record.schedule === '3'"
          color="green"
          :default-checked="true"
          bordered
          >已就业
        </a-tag>
      </template>
    </a-table>
    <!--      <template #upload="{ record }">-->
    <!--        <a-button type="primary" @click="addprofile(record)">提交简历</a-button>-->
    <!--      </template>-->
    <!--      <template #optional="{ record }">-->
    <!--        <a-button type="primary" @click="provide(record)">提供岗位</a-button>-->
    <!--      </template>-->
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue";
import { TeacherControllerService } from "../../../generated";
import message from "@arco-design/web-vue/es/message";

const tableRef = ref();
const dataList = ref([]);
const columns = [
  {
    title: "学号",
    dataIndex: "userAccount",
  },
  {
    title: "专业班级",
    dataIndex: "majorClass",
  },
  {
    title: "学生姓名",
    dataIndex: "name",
  },
  {
    title: "就业状态",
    slotName: "schedule",
  },
];

onMounted(() => {
  loadData();
});

const loadData = async () => {
  const res = await TeacherControllerService.getStudentUsingGet();
  if (res.success === true) {
    dataList.value = res.data;
    console.log(res);
  } else {
    message.error("加载失败");
  }
};
</script>

<style scoped>
#teaJobProvided {
  /* 可以添加一些样式进行自定义 */
}

.container {
  display: flex;
  align-items: center; /* 让内容垂直居中 */
}

.input-group {
  margin-right: 10px; /* 设置输入框组的右边距 */
}

.add-button {
  margin-left: 10px; /* 设置按钮左边距 */
}
</style>
